/*
 *
 *方法的整理与重构
 *
 *
 */

//定义app参数名称，并加载其它模块
var authApp=angular.module('authapp', ["ngCookies",'ngFileUpload','ui.bootstrap']);

//此为定位页面所用
authApp.value('page','schoolAlongWith');

/*controller部分*/

//主要操作controller
authApp.controller("opinionEditController",function($scope,$http,$getQueryString,$timeout,$sce){
	 var school_id=location.search.substr(1).split("+")[0];
	 var sign=location.search.substr(1).split("+")[1];
	 var school_name=decodeURIComponent(decodeURIComponent(location.search.substr(1).split("+")[2]));
	 var pid=location.search.substr(1).split("+")[3];
	 var schoolName = unescape(school_name.replace(/\\/g, "%"));
	 $scope.schoolId = schoolName;
	console.log(paths.path.seeInformation+"?"+pid+"+"+school_id)
	
	$scope.save_a = function(){
            var obj = {'schoolId':school_id,'kind':$scope.kind,'reportingTime':$scope.reportingTime,'teacher':$scope.teacher,'subject':$scope.subject,
            'classs':$scope.classs,'teachingTime':$scope.teachingTime,'weekClassHours':$scope.weekClassHours,'technicalTitle':$scope.technicalTitle,'teachContent':$scope.teachContent,
            'level':$scope.level,'generalComment':$scope.generalComment,'sign':decodeURIComponent(sign),}
          	$http({
		        method:'post',
		        url:apis.saveCourseRecord,
		        data:obj,
		    }).success(function(response){
		        if(response.code=="000000"){
		            location.href = paths.path.seeInformation+"?"+sign+"+"+school_id;
		        }else{
		            alert(response.errorMsg);
		        }
		    }).error(function(){
		        alert("服务器打瞌睡了，请稍等！");
		    })
	}

})
function toUnicode(str)
    {
        return escape(str).replace(/%/g,"\\").toLowerCase();
    }